package com.demo.generic;

import java.util.Random;

/**
 * @author linchong
 * @version 1.0
 * @Date: 2022-05-11 9:12
 * @Description: RobotFactory$
 */
public class RobotFactory implements GenericIFactory<String, Integer> {

	private String[] stringRobot = new String[]{"Hello","Hi"};

	private Integer[] integerRobot = new Integer[]{11,22};

	@Override
	public String nextObject() {
		Random random = new Random();
		//[0,2)
		return stringRobot[random.nextInt(2)];
	}

	@Override
	public Integer nextNumber() {
		Random random = new Random();
		return integerRobot[random.nextInt(2)];
	}

	public static void main(String[] args) {
		GenericIFactory<String,Integer> factory = new RobotFactory();
		System.out.println(factory.nextObject());
		System.out.println(factory.nextNumber());
	}
}
